package com.skyolder.milkbee.domain;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A ExchangeRecord. 积分商品兑换记录
 * wareId 商品ID
 * name 商品名称
 * cost 花费积分
 * quantum 数量
 * createdAt 创建时间
 * modifiedAt 修改时间
 * userId 用户ID
 * leaguerId 会员ID
 * schedule 兑换进度   {申请，同意，完成，拒绝} 1,2,3,4
 * history 进度历史
 */
@Entity
@Table(name = "exchange_record")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ExchangeRecord implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "ware_id")
    private Long wareId;

    @Column(name = "name")
    private String name;

    @Column(name = "cost")
    private Integer cost;

    @Column(name = "quantum")
    private Integer quantum;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "modified_at")
    private ZonedDateTime modifiedAt;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "leaguer_id")
    private Long leaguerId;

    @Column(name = "schedule")
    private String schedule;

    @Column(name = "history")
    private String history;
    
    @Column(name = "photograph")
    private String photograph;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getWareId() {
        return wareId;
    }

    public ExchangeRecord wareId(Long wareId) {
        this.wareId = wareId;
        return this;
    }

    public void setWareId(Long wareId) {
        this.wareId = wareId;
    }

    public String getName() {
        return name;
    }

    public ExchangeRecord name(String name) {
        this.name = name;
        return this;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getCost() {
        return cost;
    }

    public ExchangeRecord cost(Integer cost) {
        this.cost = cost;
        return this;
    }

    public void setCost(Integer cost) {
        this.cost = cost;
    }

    public Integer getQuantum() {
        return quantum;
    }

    public ExchangeRecord quantum(Integer quantum) {
        this.quantum = quantum;
        return this;
    }

    public void setQuantum(Integer quantum) {
        this.quantum = quantum;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public ExchangeRecord createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public ZonedDateTime getModifiedAt() {
        return modifiedAt;
    }

    public ExchangeRecord modifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
        return this;
    }

    public void setModifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
    }

    public Long getUserId() {
        return userId;
    }

    public ExchangeRecord userId(Long userId) {
        this.userId = userId;
        return this;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getLeaguerId() {
        return leaguerId;
    }

    public ExchangeRecord leaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
        return this;
    }

    public void setLeaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
    }

    public String getSchedule() {
        return schedule;
    }

    public ExchangeRecord schedule(String schedule) {
        this.schedule = schedule;
        return this;
    }

    public void setSchedule(String schedule) {
        this.schedule = schedule;
    }

    public String getHistory() {
        return history;
    }

    public ExchangeRecord history(String history) {
        this.history = history;
        return this;
    }

    public void setHistory(String history) {
        this.history = history;
    }
    public String getPhotograph() {
        return photograph;
    }

    public ExchangeRecord photograph(String photograph) {
        this.photograph = photograph;
        return this;
    }

    public void setPhotograph(String photograph) {
        this.photograph = photograph;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ExchangeRecord exchangeRecord = (ExchangeRecord) o;
        if (exchangeRecord.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, exchangeRecord.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "ExchangeRecord{" +
            "id=" + id +
            ", wareId='" + wareId + "'" +
            ", name='" + name + "'" +
            ", cost='" + cost + "'" +
            ", quantum='" + quantum + "'" +
            ", createdAt='" + createdAt + "'" +
            ", modifiedAt='" + modifiedAt + "'" +
            ", userId='" + userId + "'" +
            ", leaguerId='" + leaguerId + "'" +
            ", schedule='" + schedule + "'" +
            ", history='" + history + "'" +
            '}';
    }
}
